import { Rule } from "./types";

export const BundlerRules: Rule[] = [
    {
        id: "Bundler/DuplicatedGem",
        enabled: true,
        descEn: "Checks for duplicate gem entries in Gemfile.",
        descCn: "",
        versionAdded: "0.46",
        versionChanged: "1.40",
        paramList: [
            {
                param: "Severity",
                defaultValue: "warning",
                optionList: ["info", "refactor", "convention", "warning", "error", "fatal"],
            },
            {
                param: "Include",
                defaultValue: ["**/*.gemfile", "**/Gemfile", "**/gems.rb"],
            }
        ],
        url: "https://docs.rubocop.org/rubocop/1.50/cops_bundler.html#bundlerduplicatedgem",
    },
    {
        id: "Bundler/GemComment",
        enabled: false,
        descEn: "Add a comment describing each gem.",
        descCn: "",
        versionAdded: "0.59",
        versionChanged: "0.85",
        paramList: [
            {
                param: "Include",
                defaultValue: ["**/*.gemfile", "**/Gemfile", "**/gems.rb"],
            },
            {
                param: "IgnoredGems",
                defaultValue: [],
            },
            {
                param: "OnlyFor",
                defaultValue: [],
            },
        ],
        url: "https://docs.rubocop.org/rubocop/1.50/cops_bundler.html#bundlergemcomment",
    },
    {
        id: "Bundler/GemFilename",
        enabled: true,
        descEn: "Enforces the filename for managing gems.",
        descCn: "",
        versionAdded: "1.20",
        paramList: [
            {
                param: "EnforcedStyle",
                defaultValue: "Gemfile",
                optionList: ["Gemfile", "gems.rb"],
            },
            {
                param: "Include",
                defaultValue: ["**/Gemfile", "**/gems.rb", "**/Gemfile.lock", "**/gems.locked"],
            },
        ],
        url: "https://docs.rubocop.org/rubocop/1.50/cops_bundler.html#bundlergemfilename",
    },
    {
        id: "Bundler/GemVersion",
        enabled: false,
        descEn: "Requires or forbids specifying gem versions.",
        descCn: "",
        versionAdded: "1.14",
        paramList: [
            {
                param: "EnforcedStyle",
                defaultValue: "required",
                optionList: ["required", "forbidden"],
            },
            {
                param: "Include",
                defaultValue: ["**/*.gemfile", "**/Gemfile", "**/gems.rb"],
            },
            {
                param: "AllowedGems",
                defaultValue: [],
            }
        ],
        url: "https://docs.rubocop.org/rubocop/1.50/cops_bundler.html#bundlergemversion",
    },
    {
        id: "Bundler/InsecureProtocolSource",
        enabled: true,
        descEn: `The source \`:gemcutter\`, \`:rubygems\` and \`:rubyforge\` are deprecated
        because HTTP requests are insecure. Please change your source to
        'https://rubygems.org' if possible, or 'http://rubygems.org' if not.`,
        descCn: "",
        versionAdded: "0.50",
        versionChanged: "1.40",
        paramList: [
            {
                param: "Severity",
                defaultValue: "warning",
                optionList: ["info", "refactor", "convention", "warning", "error", "fatal"],
            },
            {
                param: "AllowHttpProtocol",
                defaultValue: true,
            },
            {
                param: "Include",
                defaultValue: ["**/*.gemfile", "**/Gemfile", "**/gems.rb"],
            }
        ],
        url: "https://docs.rubocop.org/rubocop/1.50/cops_bundler.html#bundlerinsecureprotocolsource",
    },
    {
        id: "Bundler/OrderedGems",
        enabled: true,
        descEn: "Gems within groups in the Gemfile should be alphabetically sorted.",
        descCn: "",
        versionAdded: "0.46",
        versionChanged: "0.47",
        paramList: [
            {
                param: "TreatCommentsAsGroupSeparators",
                defaultValue: true,
            },
            {
                param: "ConsiderPunctuation",
                defaultValue: false,
            },
            {
                param: "Include",
                defaultValue: ["**/*.gemfile", "**/Gemfile", "**/gems.rb"],
            }
        ],
        url: "https://docs.rubocop.org/rubocop/1.50/cops_bundler.html#bundlerorderedgems",
    },
];